
FigureStart = 6;
ExcelSheet = 6;
mat_filename = FUN_loadData(ExcelSheet);
load(mat_filename);
figure('Name','Simulation Plot Window','NumberTitle','off')
month = t';
pressure = ppg_data';
f1 = fit(month,pressure,'fourier2')
subplot(2,1,1)
plot(f1,month,pressure)
w = f1.w
2*pi/w
f2 = fit(month,pressure,'fourier8')
plot(f2,month,pressure)
w = f2.w
(2*pi)/w
w = (2*pi)/96
coeffnames(f2)
coeffs = coeffvalues(f2)
coeffs(:,18) = w
[f3,gof,output] = fit(month,pressure,'fourier8', 'StartPoint', coeffs);
plot(f3,month,pressure)
hold on
plot(f2, 'b')
hold off
legend( 'Data', 'f3', 'f2')
fitoptions('Fourier8')
subplot(2,1,2)
plot(month,output.residuals);

FUN_plotDataFreq(1,output.residuals);

% [f4,gof,output4] = fit(month,output.residuals,'fourier8');
% figure(15);subplot(2,1,2);hold on
% data_x = output4.residuals;
% plot(month,output4.residuals);